package com.example.provid.demo.Servicimpl;
import com.alibaba.dubbo.config.annotation.Service;
import com.example.inf.infa.myfac.RemoteUserService;
import com.netflix.hystrix.contrib.javanica.annotation.HystrixCommand;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Component;
import java.lang.Math.*;

@Service
@Component

public class RemoteUserServiceImpl implements RemoteUserService {

    private static final Logger logger = LoggerFactory.getLogger(RemoteUserServiceImpl.class);


    @HystrixCommand
    @Override
    public String sayHello(String name) {
        if (Math.random() > 0.5) {
            throw new RuntimeException();
        } else {
            return "Hello " + name;
        }
    }
}